<style lang="less" scoped>
.tb-oper-dropdown-menu {
  margin-top: 0 !important;
}
.qrCode {
  width: 200px;
  height: 200px;
  margin-bottom: 20px;
}
/deep/.qrCodevisible {
  .el-dialog__body {
    display: flex;
    justify-content: center !important;
    flex-direction: column;
    align-items: center;
  }
}
</style>
<template>
  <div class="page-census page-record">
    <div class="crumbs">
      <router-link to="/">首页</router-link> /
      <span class="active">一企一档</span>
    </div>
    <el-container :style="{ height: mainH + 'px' }">
      <el-aside class="area-blk" width="238px">
        <h2 class="hd">行政区域</h2>
        <areaTree @nodeClick="areaClickAction" ref="areaTreeList"></areaTree>
      </el-aside>
      <el-main class="census-main">
        <div class="opers flex v-c">
          <el-form :inline="true" class="filter-blk flex-1">
            <el-form-item class="ml-20" label="企业名称">
              <el-input
                placeholder="请输入企业名称"
                v-model.trim="filterForm.name"
              ></el-input>
            </el-form-item>
            <el-form-item class="ml-20" label="消防等级">
              <el-select
                v-model="filterForm.fireRating"
                placeholder="请选择"
                clearable
              >
                <el-option
                  :label="item.name"
                  :value="item.id"
                  v-for="(item, key) in levelList"
                  :key="key"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item class="ml-20" label="检查状态">
              <el-select v-model="checkState" placeholder="请选择" clearable>
                <el-option
                  :label="item"
                  :value="key"
                  v-for="(item, key) in systemList"
                  :key="key"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item>
              <el-button type="primary" @click="searchAction"
                ><i class="iconfont icon-search"></i> 搜索</el-button
              >
              <el-button type="primary" @click="resetAction"
                ><i class="iconfont icon-refresh"></i> 重置</el-button
              >
              <el-button type="primary" @click="searchExpire">{{
                expireItem
              }}</el-button>
            </el-form-item>
          </el-form>
          <div>
            <template v-if="area">
              <el-upload
                style="display: inline-block; margin: 0 10px"
                :action="config.baseApi + '/uploadFile/businessImport'"
                :limit="1"
                accept=".xlsx"
                :show-file-list="false"
                :on-success="importSuccess"
                :on-error="importError"
                :headers="{ Authorization: 'Bearer ' + siteInfos.token }"
                :data="uploadParams"
                v-if="hasPermission('002016')"
              >
                <el-button type="blue">
                  <i class="iconfont icon-import-folder"></i>
                  导入
                </el-button>
                <!-- <el-button size="small" type="green">点击上传</el-button> -->
              </el-upload>
              <el-button
                v-if="hasPermission('002017')"
                type="blue"
                @click="downloadAction"
              >
                <i class="iconfont icon-download"></i> 模板下载
              </el-button>
            </template>

            <!-- <el-button
                            type="green"
                            @click="showAllMonitor"
                            v-if="hasPermission('002006')"
                        >
                            <i class="iconfont icon-camera"></i> 鹰眼e通
                        </el-button> -->
            <!-- <el-dropdown
              v-if="hasPermission('002007') || hasPermission('002008')"
              class="ml-10"
              type="primary"
              size="small"
            > -->
            <el-button
              v-if="hasPermission('002007') || hasPermission('002008')"
              type="primary"
              :disabled="!$store.getters.hasEditPermission"
              @click="newAction(1)"
            >
              <i class="iconfont icon-add"></i> 新增
              <!-- <i
                  class="el-icon-arrow-down el-icon--right"
                ></i> -->
            </el-button>
            <!-- <el-dropdown-menu class="tb-oper-dropdown-menu" slot="dropdown">
                <el-dropdown-item v-if="hasPermission('002001')">
                  <el-button type="blue" @click="newAction(1)"
                    >消防单位</el-button
                  >
                </el-dropdown-item>
                <el-dropdown-item v-if="hasPermission('002009')" class="mt-10">
                  <el-button type="blue" @click="newAction(2)"
                    >市场质量监督单位</el-button
                  >
                </el-dropdown-item>
                <el-dropdown-item v-if="hasPermission('002011')" class="mt-10">
                  <el-button type="blue" @click="newAction(2)"
                    >应急单位</el-button
                  >
                </el-dropdown-item>
                <el-dropdown-item v-if="hasPermission('002012')" class="mt-10">
                  <el-button type="blue" @click="newAction(2)"
                    >社会单位</el-button
                  >
                </el-dropdown-item>
                <el-dropdown-item v-if="hasPermission('002013')" class="mt-10">
                  <el-button type="blue" @click="newAction(2)"
                    >综合行政单位</el-button
                  >
                </el-dropdown-item>
                <el-dropdown-item v-if="hasPermission('002014')" class="mt-10">
                  <el-button type="blue" @click="newAction(2)"
                    >综合党政单位</el-button
                  >
                </el-dropdown-item>
                <el-dropdown-item v-if="hasPermission('002015')" class="mt-10">
                  <el-button type="blue" @click="newAction(2)"
                    >教育单位</el-button
                  >
                </el-dropdown-item> 
              </el-dropdown-menu> -->
            <!-- </el-dropdown> -->
          </div>
        </div>
        <el-table :data="dataList" style="width: 100%" v-loading="loading">
          <el-table-column
            type="index"
            label="序号"
            width="60"
            :index="indexMethod"
          ></el-table-column>
          <el-table-column
            prop="name"
            label="企业名称"
            width="200"
          ></el-table-column>
          <el-table-column
            prop="enterpriseCode"
            label="企业单位代码"
            width="150"
          ></el-table-column>
          <el-table-column
            prop="areaName"
            label="所属行政区域"
            width="240"
          ></el-table-column>
          <el-table-column
            prop="fireRatingName"
            label="消防等级"
            width="150"
          ></el-table-column>
          <el-table-column
            prop="unitPropertyName"
            label="单位性质"
            width="100"
          ></el-table-column>
          <el-table-column
            prop="isHighRiskName"
            label="是否高危"
          ></el-table-column>
          <el-table-column
            prop="expirationTime"
            label="剩余天数"
          ></el-table-column>
          <el-table-column label="操作" :width="390">
            <!--				    <el-table-column label="操作" width="320">-->
            <template slot-scope="scope">
              <div class="nowrap">
                <el-button
                  type="primary"
                  v-if="hasPermission('002002')"
                  @click="detailAction(scope.row)"
                  >详情</el-button
                >
                <el-button
                  type="green"
                  v-if="hasPermission('002003')"
                  @click="accountAction(scope.row)"
                  :disabled="!$store.getters.hasEditPermission"
                  >账号</el-button
                >
                <el-button
                  type="green"
                  @click="editAction(scope.row)"
                  v-if="hasPermission('002004')"
                  :disabled="!$store.getters.hasEditPermission"
                  >编辑</el-button
                >
                <el-button
                  type="danger"
                  @click="deleteAction(scope.row)"
                  v-if="hasPermission('002005')"
                  :disabled="!$store.getters.hasEditPermission"
                  >删除</el-button
                >

                <el-dropdown
                  v-if="scope.row.cameraType == 1 && hasPermission('002006')"
                  class="ml-10"
                  type="primary"
                  size="small"
                >
                  <el-button type="green">
                    鹰眼<i class="el-icon-arrow-down el-icon--right"></i>
                  </el-button>
                  <el-dropdown-menu
                    class="tb-oper-dropdown-menu"
                    slot="dropdown"
                  >
                    <el-dropdown-item
                      ><el-button
                        type="green"
                        @click="monitorAction(scope.row)"
                        v-if="scope.row.cameraType == 1"
                        >鹰眼e 通</el-button
                      ></el-dropdown-item
                    >
                    <el-dropdown-item class="mt-10"
                      ><el-button
                        type="green"
                        @click="playbackAction(scope.row)"
                        v-if="scope.row.cameraType == 1"
                        >鹰眼回放</el-button
                      ></el-dropdown-item
                    >
                  </el-dropdown-menu>
                </el-dropdown>

                <el-dropdown
                  v-if="hasPermission('002007') || hasPermission('002008')"
                  class="ml-10"
                  type="primary"
                  size="small"
                >
                  <el-button
                    type="primary"
                    :disabled="!$store.getters.hasEditPermission"
                  >
                    更多<i class="el-icon-arrow-down el-icon--right"></i>
                  </el-button>
                  <el-dropdown-menu
                    class="tb-oper-dropdown-menu"
                    slot="dropdown"
                  >
                    <el-dropdown-item v-if="hasPermission('002007')"
                      ><el-button type="primary" @click="renewAction(scope.row)"
                        >续费</el-button
                      ></el-dropdown-item
                    >
                    <el-dropdown-item
                      v-if="hasPermission('002008')"
                      class="mt-10"
                      ><el-button
                        type="primary"
                        @click="communicationLog(scope.row)"
                        >通讯记录</el-button
                      ></el-dropdown-item
                    >
                    <el-dropdown-item
                      v-if="hasPermission('002010')"
                      class="mt-10"
                      ><el-button
                        type="primary"
                        @click="openVoiceSMS(scope.row)"
                        >开关语音/短信</el-button
                      ></el-dropdown-item
                    >
                    <el-dropdown-item class="mt-10">
                      <el-button type="primary" @click="getCode(scope.row)"
                        >生成二维码</el-button
                      >
                    </el-dropdown-item>
                    <!-- <el-dropdown-item
                      v-if="hasPermission('002010')"
                      class="mt-10"
                      ><el-button type="primary" @click="openNotice(scope.row)"
                        >短信设置</el-button
                      ></el-dropdown-item
                    > -->
                  </el-dropdown-menu>
                </el-dropdown>
              </div>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination
          v-if="total > 0"
          class="text-right mt-20 mr-20"
          @current-change="handleCurrentChange"
          :current-page="currentPage"
          :page-size="pageSize"
          layout="prev, pager, next, total, jumper"
          :total="total"
        >
        </el-pagination>
      </el-main>
    </el-container>
    <!-- 添加/编辑 start -->
    <el-dialog
      v-if="newModalVisible"
      :title="newModalTitle"
      :visible.sync="newModalVisible"
      width="660px"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      destroy-on-close
    >
      <New
        ref="newData"
        :area="area"
        :areaNames="activeAreaNames"
        :unitList="unitList"
        :levelList="levelList"
        :industryList="industryList"
        :activeData="activeData"
        @success="submitSuccessAction"
        @fail="adding = false"
        @submitting="adding = true"
        @cancel="newModalVisible = false"
      >
      </New>
      <div slot="footer">
        <el-button type="cancel" @click="newModalVisible = false"
          >取消</el-button
        >
        <el-button
          type="primary"
          :loading="adding"
          @click="submitAction"
          :disabled="!$store.getters.hasEditPermission"
          >确定</el-button
        >
      </div>
    </el-dialog>
    <!-- 添加/编辑 end -->
    <!-- 详情 start -->
    <el-dialog
      v-if="detailModalVisible"
      :modal="false"
      :title="detailModalTitle"
      :visible.sync="detailModalVisible"
      width="1000px"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      destroy-on-close
    >
      <Detail
        ref="detail"
        :data="activeData"
        @success="submitSuccessAction"
        @cancel="detailModalVisible = false"
      >
      </Detail>
    </el-dialog>
    <!-- 详情 end -->
    <!-- 账号 start -->
    <el-dialog
      v-if="accountModalVisible"
      :title="accountModalTitle"
      :visible.sync="accountModalVisible"
      width="1000px"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      destroy-on-close
    >
      <Account
        ref="account"
        :activeData="activeData"
        @cancel="accountModalVisible = false"
      >
      </Account>
    </el-dialog>
    <!-- 账号 end -->
    <!-- 通讯记录 start -->
    <el-dialog
      v-if="communicationModalVisible"
      :title="communicationModalTitle"
      :visible.sync="communicationModalVisible"
      width="1200px"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      destroy-on-close
    >
      <Communication
        ref="communication"
        :activeData="activeData"
        @cancel="communicationModalVisible = false"
      >
      </Communication>
    </el-dialog>
    <!-- 通讯记录 end -->
    <!-- 续费 start -->
    <el-dialog
      v-if="renewModalVisible"
      :title="renewModalTitle"
      :visible.sync="renewModalVisible"
      width="500px"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      destroy-on-close
    >
      <Renew
        ref="newData"
        :activeData="activeData"
        @success="submitSuccessAction"
        @fail="adding = false"
        @submitting="adding = true"
        @cancel="renewModalVisible = false"
      >
      </Renew>
      <div slot="footer">
        <el-button type="cancel" @click="renewModalVisible = false"
          >取消</el-button
        >
        <el-button type="primary" :loading="adding" @click="submitAction"
          >确定</el-button
        >
      </div>
    </el-dialog>
    <!-- 续费 end -->
    <!-- 续费 start -->
    <el-dialog
      v-if="voiceSMSVisible"
      title="一键开关语音/短信"
      :visible.sync="voiceSMSVisible"
      width="500px"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      destroy-on-close
    >
      <RecordVoiceSMS
        ref="voiceSMS"
        :activeData="activeData"
        @success="submitVoiceSuccessAction"
        @fail="adding = false"
        @submitting="adding = true"
        @cancel="RecordVoiceSMS = false"
      >
      </RecordVoiceSMS>
      <div slot="footer">
        <el-button type="cancel" @click="RecordVoiceSMS = false"
          >取消</el-button
        >
        <el-button type="primary" :loading="adding" @click="submitVoiceAction"
          >确定</el-button
        >
      </div>
    </el-dialog>
    <!-- 续费 end -->
    <!-- 二维码 star -->
    <el-dialog
      v-if="code"
      title="二维码"
      :visible.sync="code"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      width="450px"
      class="qrCodevisible"
    >
      <div id="qrCode" class="qrCode" ref="courseInfo">
        <vue-qr ref="qrCode" :text="activeData.id" width="200" height="200">
        </vue-qr>
      </div>
      <div>
        <el-button type="primary" @click="save" size="small"
          >保存到本地</el-button
        >
        <el-button type="primary" v-print="'#qrCode'" size="small"
          >打印</el-button
        >
      </div>
    </el-dialog>
    <!-- 二维码 end -->
  </div>
</template>
<script>
import { mapState } from "vuex";
import Renew from "@/components/census/record/Renew.vue";
import New from "@/components/census/record/RecordNew.vue";
import Detail from "@/components/census/record/RecordDetail.vue";
import Account from "@/components/census/record/RecordAccount.vue";
import Communication from "@/components/census/record/RecordCommunication.vue";
import RecordVoiceSMS from "@/components/census/record/recordVoiceSMS.vue";
import areaTree from "@/components/census/AreaTree.vue";
import utils from "@/assets/js/utils";
import VueQr from "vue-qr";
import html2canvas from "html2canvas";
export default {
  name: "Notice",
  props: {
    winH: {
      type: Number,
      default: 500,
    },
  },
  components: {
    New,
    Detail,
    Account,
    Communication,
    areaTree,
    Renew,
    RecordVoiceSMS,
    VueQr,
  },
  data() {
    return {
      openMaintenance: utils.getStorage("SITE_INFOS").openMaintenance,
      area: "", //行政区划ID
      filterForm: {},
      total: 0,
      currentPage: 1,
      pageSize: 10,
      sort: false,
      expireItem: "查看即将过期",
      loading: false,
      dataList: [],
      unitList: [],
      unitObj: null,
      levelList: [],
      levelObj: null,
      industryList: [],
      activeData: null,
      newModalTitle: "新增企业单位档案",
      newModalVisible: false,
      adding: false,
      deleting: false,

      detailModalTitle: "企业单位详情",
      detailModalVisible: false,

      accountModalTitle: "企业单位账号列表",
      accountModalVisible: false,

      renewModalTitle: "续费",
      renewModalVisible: false,
      activeAreaLevel: 0,
      activeAreaNames: [],
      communicationModalTitle: "",
      communicationModalVisible: false,
      voiceSMSVisible: false,
      uploadParams: {},
      code: false,
      qrCodeUrl: "",
      systemList: [
        "全部",
        "检查结束",
        "待检查",
        "正在检查",
        "待复查",
        "待二次复查",
      ],
      checkState: "",
    };
  },
  watch: {},
  computed: {
    ...mapState(["scale", "siteInfos"]),
    mainH() {
      return this.winH - 200;
    },
  },
  methods: {
    //保存二维码
    save() {
      html2canvas(this.$refs.courseInfo).then((canvas) => {
        let link = document.createElement("a");
        link.href = canvas.toDataURL();
        link.setAttribute("download", "下载.png");
        link.style.display = "none";
        document.body.appendChild(link);
        link.click();
      });
    },
    getCode(item) {
      this.code = true;
      this.activeData = item;
    },
    importSuccess(res, file) {
      if (res.code == 0) {
        let resData = JSON.parse(res.data);
        if (resData.webPath) {
          window.open(
            this.config.baseApi +
              "/uploadFile/downloadExcel?fileName=" +
              resData.webPath
          );
        } else {
          this.$message.success("导入成功");
        }
      } else {
        this.$message.error(res.msg);
      }
    },
    importError(err, file, fileList) {
      // window.open(this.config.baseApi + '/uploadFile/downloadExcel')
    },
    downloadAction() {
      window.open(this.config.baseApi + "/uploadFile/getBusinessTemplate");
    },
    openVoiceSMS(item) {
      this.activeData = item;
      this.voiceSMSVisible = true;
    },
    submitVoiceAction() {
      this.$refs.voiceSMS.submitAction();
    },
    submitVoiceSuccessAction() {
      this.adding = false;
      this.voiceSMSVisible = false;
    },
    monitorAction(item) {
      this.$router.push(`/monitor?id=${item.id}&name=${item.name}`);
    },
    showAllMonitor() {
      this.$router.push(`/monitorAll`);
    },
    playbackAction(item) {
      this.$router.push(`/playback?id=${item.id}&name=${item.name}`);
    },
    renewAction(item) {
      this.renewModalVisible = true;
      this.activeData = item;
    },
    getData(page) {
      this.loading = true;
      this.filterForm.checkState = this.checkState == 0 ? "" : this.checkState;
      let params = Object.assign(
        {
          page: page,
          limit: this.pageSize,
          area: this.area,
          sort: this.sort,
        },
        this.filterForm
      );
      this.$get("/business/business/businessListPage", params).then(
        (res) => {
          this.loading = false;
          let data = res.data;
          this.currentPage = page;
          this.total = data.totalSize;
          this.dataList = data.Items;
        },
        (err) => {
          this.loading = false;
          if (err.msg) {
            this.$message.error(err.msg);
          }
        }
      );
    },
    getRegionDetail(id) {
      this.$get("/business/business/regionDetail", { id }).then(
        (res) => {
          this.$nextTick(() => {
            if (this.$refs.areaTreeList.treeList.length == 0) {
              this.area = id;
              this.activeAreaNames = res.data.allname.split(",");
              this.uploadParams = {
                area: this.area,
                areaName: this.activeAreaNames.join(","),
                token: this.siteInfos.token,
              };
            }
          });
        },
        (err) => {
          this.loading = false;
          if (err.msg) {
            this.$message.error(err.msg);
          }
        }
      );
    },
    getDict(groupname, cbk) {
      this.$get("/business/business/dictList", {
        groupname: groupname,
      }).then(
        (res) => {
          cbk && cbk(res.data);
        },
        (err) => {
          this.loading = false;
          if (err.msg) {
            this.$message.error(err.msg);
          }
        }
      );
    },
    getIndustry(cbk) {
      this.$get("/business/business/industryList").then(
        (res) => {
          this.industryList = res.data;
          cbk && cbk();
        },
        (err) => {
          if (err.msg) {
            this.$message.error(err.msg);
          }
        }
      );
    },
    getSelectedIndustryById(data, id) {
      let temp = null;
      for (let i = 0; i < data.length; i++) {
        if (data[i].id == id) {
          temp = data[i];
        } else if (data[i].industrys && data[i].industrys.length > 0) {
          temp = this.getSelectedIndustryById(data[i].industrys, id);
        }
        if (temp) break;
      }
      return temp;
    },
    areaClickAction(data, level, areaNames) {
      this.area = data.id;
      this.getData(1);
      this.activeAreaLevel = level;
      if (!areaNames[0]) {
        this.activeAreaNames = data.allname.split(",");
      } else {
        this.activeAreaNames = areaNames;
      }
      this.uploadParams = {
        area: this.area,
        areaName: this.activeAreaNames.join(","),
      };
    },
    indexMethod(index) {
      return (this.currentPage - 1) * this.pageSize + index + 1;
    },
    searchAction() {
      this.getData(1);
    },
    resetAction() {
      this.filterForm = {};
    },
    searchExpire() {
      this.sort = !this.sort;
      if (this.sort == true) {
        this.expireItem = "返回";
      } else {
        this.expireItem = "查看即将过期";
      }
      this.getData(1);
    },
    getDataById(id, cbk) {
      this.$get("/business/business/detail", {
        id: id,
      }).then(
        (res) => {
          let thisData = res.data;
          let thisIndustry = this.getSelectedIndustryById(
            this.industryList,
            thisData.industry
          );
          thisData.industryName = thisIndustry ? thisIndustry.name : "";
          cbk && cbk(thisData);
        },
        (err) => {
          //
        }
      );
    },
    newAction(type) {
      if (!this.area) {
        this.$message.error("请选择行政区域");
        return;
      }
      // else if (this.activeAreaLevel < 3) {
      //   this.$message.error("请选择详细的行政区域");
      //   return;
      // }
      // this.newModalTitle = type == 1 ? "新增消防单位" : "新增餐饮单位";
      this.newModalTitle = "新增消防单位";
      this.newModalVisible = true;
      this.activeData = null;
      //判断当前按钮是否可点击
      // if (this.openMaintenance != "1") {
      //   this.newModalVisible = false;
      //   alert("请前往维保系统注册")
      // }
    },
    editAction(item) {
      this.getDataById(item.id, (data) => {
        this.activeData = data;
        this.newModalTitle = "编辑企业单位档案";
        this.newModalVisible = true;
        //判断当前按钮是否可点击
        // if (this.openMaintenance != "1") {
        //   this.newModalVisible = false;
        //   alert("请前往维保系统注册")
        // }
      });
    },
    detailAction(item) {
      this.getDataById(item.id, (data) => {
        this.activeData = data;
        this.detailModalTitle = `企业单位详情(${item.name})`;
        this.detailModalVisible = true;
        //判断当前按钮是否可点击
        // if (this.openMaintenance != "1") {
        //   this.detailModalVisible = false;
        //   alert("请前往维保系统注册")
        // }
      });
    },
    accountAction(item) {
      this.accountModalTitle = `企业单位账号列表(${item.name})`;
      this.accountModalVisible = true;
      this.activeData = item;
      //判断当前按钮是否可点击
      // if (this.openMaintenance != "1") {
      //   this.accountModalVisible = false;
      //   alert("请前往维保系统注册")
      // }
    },
    communicationLog(item) {
      this.communicationModalTitle = `企业单位通讯记录(${item.name})`;
      this.communicationModalVisible = true;
      this.activeData = item;
    },
    deleteAction(item) {
      //判断当前按钮是否可点击
      // if (this.openMaintenance != "1") {
      //   alert("请前往维保系统注册")
      //   return false;
      // }
      this.showConfirm("确定删除该单位吗？", () => {
        this.deleting = true;
        this.$post("/business/business/businessDelete", {
          businessId: item.id,
        }).then(
          (res) => {
            this.deleting = false;
            this.$message.success("删除成功");
            this.getData(this.currentPage);
          },
          (err) => {
            this.deleting = false;
            this.$message.error(err.msg);
          }
        );
      });
    },
    handleCurrentChange(page) {
      this.getData(page);
    },
    submitAction() {
      this.$refs.newData.submitAction();
    },
    // 新增/编辑成功/续费成功后调用
    submitSuccessAction(data) {
      this.adding = false;
      this.newModalVisible = false;
      this.renewModalVisible = false;
      this.getData(this.currentPage);
    },
  },
  created() {
    this.getIndustry(() => {
      this.getData(1);
      if (this.siteInfos.reginId) {
        this.getRegionDetail(this.siteInfos.reginId);
      }
    });
    this.getDict("单位性质", (data) => {
      this.unitList = data;
      this.unitObj = data.map((item) => {
        let temp = {};
        temp[item.id] = item.name;
        return temp;
      });
    });
    this.getDict("消防等级", (data) => {
      this.levelList = data;
      this.levelObj = data.map((item) => {
        let temp = {};
        temp[item.id] = item.name;
        return temp;
      });
    });
    // this.getRegionDetail(this.siteInfos.reginId);
  },
  mounted() {
    // this.$nextTick(() => {
    //   console.log(this.$refs.areaTreeList.treeList);
    // });
    // if (this.$refs.areaTreeList.treeList.length == 0) {
    //   this.area = this.siteInfos.reginId;
    //   this.activeAreaNames = [this.siteInfos.homeName];
    // }
  },
};
</script>
